<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>upload模块快速使用</title>
    <asset:stylesheet href="layui/css/layui.css"/>
</head>
<body>

<button type="button" class="layui-btn" id="fileUpload">
    <i class="layui-icon">&#xe67c;</i>上传图片
</button>

<asset:javascript src="layui/layui.js"/>
<script>
    layui.use(['upload', 'layer'], function(){
        var upload = layui.upload;
        var layer = layui.layer;

        //执行实例
        var uploadInst = upload.render({
            elem: '#fileUpload' //绑定元素
            ,url: '${createLink(controller: "upload", action: "upload")}' //上传接口
            ,done: function(res){
                //上传完毕回调
                layer.msg(res.msg);
            }
            ,error: function(){
                //请求异常回调
            }
        });
    });
</script>
</body>
</html>